<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl() ;?>/css/tukhoa.css" media="screen" />
<script src="<?php echo $this->baseUrl() ;?>/scripts/sortertable/jquery.tablesorter.min.js" type="text/javascript"></script>
<script src="<?php echo $this->baseUrl() ;?>/scripts/tukhoa.js" type="text/javascript"></script>
<script type="text/javascript">
	$(document).ready(function() { 
	    $("#danh_sachthu").tablesorter(); 
	});
</script>

<div class ="conten" >

    <table cellpadding="0"  cellspacing="0" class="tableconten" border="0">
        <tr>
            <td class="left_conten" >
            <!-- left  -->
               <div class="module-left">
                      <div class="t_m">
            			<div class="t_r">
            				<h3> 
                                Tạo mới 
            					<a class="toggleicon" href='#'><div onclick="slidetoggle('99')" class='shboxs99 show'><img src="<?php echo $this->baseUrl() ;?>/images/box/down1.png" /></div><div onclick="hslidetoggle('99')" class='hshboxs99 hidden'><img src="<?php echo $this->baseUrl() ;?>/images/box/down2.png" /></div></a>
            				</h3>
            				
            			</div>
            		  </div>
            		  <div id="box99" class="module-content">
            			<ul>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-new_01.png" /><a href="<?php echo $this->baseUrl()?>/thumau/themthumau"   >Thêm thư mẫu  </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-new_01.png" /><a href="<?php echo $this->baseUrl()?>/lienhe/">Thêm liên hệ</a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-new_01.png" /><a href=""> Gửi thư </a></li>
            				
            			</ul>
            		  </div>
            		  <div class="module-bottom">
            			<div class="md-bt-r"><div class="md-bt-l">&nbsp;</div></div>
            		  </div>	                  
               </div>
               
               <!-- thao tac 2 -->
               
               <div class="module-left">
                      <div class="t_m">
            			<div class="t_r">
            				<h3> 
                                Danh Sách
            					<a class="toggleicon" href='#'><div onclick="slidetoggle('98')" class='shboxs98 show'><img src="<?php echo $this->baseUrl() ;?>/images/box/down1.png" /></div><div onclick="hslidetoggle('98')" class='hshboxs98 hidden'><img src="<?php echo $this->baseUrl() ;?>/images/box/down2.png" /></div></a>
            				</h3>
            				
            			</div>
            		  </div>
            		  <div id="box98" class="module-content">
            			
            			<ul>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/thunhap/"   >Danh sách thư nháp </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/thumau/index/"   >Danh sách thư mẫu </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/lienhe/" >Danh Sách liên hệ</a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/thudagui/" > Danh sách thư đã gửi </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/danhmuc/" > Danh mục thư </a></li>
            				<li><img class="icons" src="<?php echo $this->baseUrl();?>/images/icon/icon-32-contacts_01.png" /><a href="<?php echo $this->baseUrl()?>/tukhoa/" > Danh mục từ khóa </a></li>
            				
            			</ul>
            			
            		  </div>
            		  <div class="module-bottom">
            			<div class="md-bt-r"><div class="md-bt-l">&nbsp;</div></div>
            		  </div>	                  
               </div>                 
                             
               
            <!--  end left--> 
             </td>
            <td class="right_conten" >
            <div class="bao_benphai">
            <!-- right  -->
                <!-- breadcrumd-->
    			<div class="breadcrum" >
    				<ul>
    					<li class="home"><a href="<?php echo $this->baseUrl()?>/tukhoa/">Cài đặt hệ thống</a></li>
    					<li class="br_item"><span>Danh sách từ khóa</span></li>
    				</ul>
    			</div>
		    	<!-- end breadcrumd-->
		    	
		    	<!--  Start Thêm thư   -->
                
                     
                     <div class="timkem_list"> 
                            <span class="timthan">
                                 Thông tin  :
                            	<input type="text" id="tentim" name="keytimkiem" style="width: 250px;"  />
         						<select name="chungloaithu">
         							<option value=""  > Chọn</option>
         							<?php foreach ($this->dmtm as $key){?>
         							<option value="<?php echo $key['id']?>"> <?php echo $key['ten_loai_thu']?></option>
         							<?php }?>
         						</select> 
                            	<input type="submit" value="Tìm kiếm" class="save"/>

                            </span>

                          <div class="divthaotac" title="Xóa Thư Mẫu" align="center"> 
	                            <a href="#" onclick="xoaalltukhoa()">
	                            	 <span class="xoatoanbo"></span>
	                            	Sọt rác  
	                            </a>
                          </div>
                         <div class="divthaotac" title="Thêm Thư Mẫu"  align="center"> 
	                            <a href="#" onclick="themmoitukhoa(<?php echo $this->iddangnhap;?>)">
	                            	 <span class="themmoi"></span>
	                            	Thêm mới  
	                            </a>
                          </div>
                            <!-- Ket qua trả về --> 
                            <div class="suggestionsBox">
                               <div class="suggestionList">                            
                               </div> 
                            </div>
                            <!-- Ket qua trả về --> 
                            
                     </div>
                   
                     <!-- End Tìm kiếm  -->                
                
					<div class="box-l-n" style="clear:both;">
						<div class="box-l-n-l">
							<div class="box-l-n-r">
								<div class="box-l-n-m" align="left"> <div class="xoa_botton">    </div> <h3  >Danh sách thư mẫu </h3></div>
							</div>
						</div>
					<div class="box-l-n-body">
						<div class="box-l-n-wrr">
						<form id="danhsachtukhoa" action="">
		    			<table cellspacing="1" id="danh_sachthu">
							<thead>
							<tr align="center">
								<td width="30" ><input id="check" type="checkbox" onclick="selectReverse('danhsachtukhoa','tkid')" style="width: 50px" /></td>
								<th width="30%" ><b>Mô tả</b></th>
								<td width="20%" ><b>Mã từ khóa </b></td>
								<td width="12%"><b>Ngày tạo</b></td>
								<td ><b>Ngày sửa</b></td>
								<td width="8%" ><b>Sử dụng</b></td>
								<td ><b>Thao tác</b></td>
							</tr>
							</thead>
							<tbody>
							<?php foreach ($this->tukhoa as $tukhoa ){?>
							<tr class="row_<?php echo  $tukhoa['tk_id'] ?>">
								<td align="center" ><input type="checkbox" id="tkid_" value="<?php echo  $tukhoa['tk_id'] ?>" name="listtk[]"/></td>
								<td width="30%" >
									
									 <b><?php echo $tukhoa['mo_ta'] ?></b>
								</td>
								<td width="20%" align="center">
									<?php echo $tukhoa['ten_tu_khoa']?>
							    </td>
								<td width="12%" align="center">
									<?php echo $tukhoa['ngay_tao']?>
								</td>
								<td  width="12%">
									<?php echo $tukhoa['ngay_sua']?>
								</td>
								<td align="center" width="8%">
									<?php if($tukhoa['su_dung'] =="1"){ ?>
										<samp id='tu_khoa_<?php echo $tukhoa['tk_id']?>'><a href="#" onclick="khongsudungtukhoa('<?php echo $this->iddangnhap;?>','<?php echo $tukhoa['tk_id'] ?>','0');" >  
											<img title="Không sử dụng từ khóa này" src="<?php echo $this->baseUrl() ?>/images/icon/check2.png"  width="17" hight="17" />
										</a></samp>	 
									<?php }else {?>
										<samp id='tu_khoa_<?php echo $tukhoa['tk_id']?>'><a href="#" onclick="sudungtukhoa('<?php echo $this->iddangnhap;?>','<?php echo $tukhoa['tk_id'] ?>','1');" >  
											<img title="Sử dụng từ khóa này" src="<?php echo $this->baseUrl() ?>/images/icon/notice-alert.png"  width="17" hight="17" />
										</a></samp>	
										
									<?php }?>
								</td>
								<td align="center">
									<a href="#" onclick="suatukhoa(<?php echo $tukhoa['tk_id']; ?>)"><span ><img class="icons" title="Sửa từ khóa" src="<?php echo $this->baseUrl() ?>/images/icon/page_white_edit.png"></span></a>
								 	<a href="#"> <span onclick="xoatukhoa('<?php echo $tukhoa['tk_id'] ?>')"><img class="icons" title="Xóa từ khóa" src="<?php echo $this->baseUrl() ?>/images/icon/icon-16-delete.png"></span></a>
								</td>
							</tr>
								<?php }?>				
							</tbody>
						</table>
						</form>
						</div>
					
					</div>
			   </div>
			
				<input type="hidden" value="<?php echo $this->baseUrl()?>" id="url"/>
				<input type="hidden" value="<?php echo $this->iddangnhap;?>" id="iddn"/>
		    	<!--  End them thư  -->
		    	
		    </div>	
            <!-- right -->
            </td>
            
        </tr>
    
    </table>
</div>


<!-- Thêm tu khoa  -->
<div id= "themnhomtukhoa" title="Thêm mới từ khóa" style="display:none;">
            <form id="themthukh" action="<?php echo $this->baseUrl();?>/tukhoa/addtukhoa" method="post" onsubmit="return checkthemthukhoa()" >
            <div class="row_1" style="margin-top:15px;"> 
                <div class="ten_chu"><label for="name">Thông tin:  </label></div>
                <div class="input_popup" >
		                <select name="truongcanlay" id="truongcanlay">
		                	<option value="0"> Chọn  </option>
		                	<?php foreach ($this->truongtrondb as $tukhoaadd ){?>
		                		<option value="<?php echo $tukhoaadd['truongtrondb'];?>"> <?php echo $tukhoaadd['hienthi'];?>  </option>
		                	<?php }?>
		                </select>
                </div>
            </div> 
            <div class="row_1" > 
                <div class="ten_chu"><label for="name">Mã từ khóa:  </label></div>
                <div class="input_popup" ><samp style="font-size: 14px; font-weight: bold;">{</samp><input type="text" name="tentukhoahienthi" id="tentukhoahienthi"  /><samp style="font-size: 14px; font-weight: bold;">}</samp></div>
            </div> 
            
            <div class="row_1" > 
                <div class="ten_chu"><label for="name">Mô tả:  </label></div>
                <div class="input_popup" ><textarea id="mota" name="mota"></textarea></div>
            </div> 
                        
           <div align="center" style="padding-top: 50px;">
           <input type="hidden" value="<?php echo $this->baseUrl()?>" id="urlsua"/>
           <input type="hidden" value="<?php echo $this->iddangnhap;?>" name="idtao" id="idtao"/>
            <input type="submit"  class="save" value="Lưu lại" style="width:100px;" />
            
            </div>
           </form> 
</div>
<!-- End  Thêm tu khoa  -->



<!-- Sua tu khoa  -->
<div id= "suatukhoa" title="Sửa từ khóa" style="display:none;">
            <form  action="<?php echo $this->baseUrl();?>/tukhoa/edittukhoa" method="post" onsubmit="return checkthemthukhoasua()" >
            <div class="row_1" style="margin-top:15px;"> 
                <div class="ten_chu"><label for="name">Thông tin:  </label></div>
                <div class="input_popup" >
		                <select name="truongcanlay" id="truongcanlay_edit">
		                	<option value="0"> Chọn  </option>
		                	<?php foreach ($this->truongtrondb as $tukhoaadd ){?>
		                		<option value="<?php echo $tukhoaadd['truongtrondb'];?>"> <?php echo $tukhoaadd['hienthi'];?>  </option>
		                	<?php }?>
		                </select>
                </div>
            </div> 
            <div class="row_1" > 
                <div class="ten_chu"><label for="name">Mã từ khóa:  </label></div>
                <div class="input_popup" ><samp style="font-size: 14px; font-weight: bold;">{</samp><input type="text" name="tentukhoahienthi_edit" id="tentukhoahienthi_edit"  /><samp style="font-size: 14px; font-weight: bold;">}</samp></div>
            </div> 
            
            <div class="row_1" > 
                <div class="ten_chu"><label for="name">Mô tả:  </label></div>
                <div class="input_popup" ><textarea id="mota_edit" name="mota_edit"></textarea></div>
            </div> 
                        
           <div align="center" style="padding-top: 50px;">
           <input type="hidden" value="<?php echo $this->baseUrl()?>" id="url"/>
           <input type="hidden" value="" name="idtukhoa" id="idtukhoa"/>
           <input type="hidden" value="<?php echo $this->iddangnhap;?>" name="idtao_sua" id="idtao_sua"/>
            <input type="submit"  class="save" value="Lưu lại" style="width:100px;" />
            
            </div>
           </form> 
</div>
<!-- Sua  Thêm tu khoa  -->